/**
 *  Base for all entity objects in the system
 *
 *  @author Scott Monahan
 *  @version $Id$
 *  
 *  File last changed on $Date:$ by $Author:$ in $Rev:$
 *
 */

package info637.pprc.repository;

public abstract class AbstractEntity {
	
	private String id = null;
	
	protected final static String CLEAR = "*CLEAR*";

	public String getId() {
		
		return this.id;
	}
	
	protected void setId(String id) {
		
		this.id = id;
	}
	
	protected String updateValue(String currentVal, String newVal) {
		
		if (newVal != null) {
			
			if (newVal.equalsIgnoreCase(CLEAR)) {
				
				return "";
				
			} else {
				
				if (newVal.trim().length() > 0) {
					
					return newVal;
					
				} else {
					
					return currentVal;
				}
			}
			
		} else {
			
			return currentVal;
		}
	}
}
